import java.util.Arrays;
import java.math.MathContext; 
import java.util.Scanner;
class Shape{
	final double PI = 3.14 ;
	public double getPerimeter(){
		return 0;
	}
	public double getArea(){
		return 0;
	}
	public double sumAllArea(Shape [] shape){
		double result = 0;
		for (int i = 0; i < shape.length; i++) {
			result += shape[i].getArea() ;
		}
		return result ;
	}
	public double sunAllPerimeter(Shape [] shape){
		double result = 0 ;
		for (int i = 0; i < shape.length; i++) {
			result += shape[i].getPerimeter() ;
		}
		return result ;
	}
}
class Rectangle extends Shape{
	private int width ;
	private int length ;
	public Rectangle(int width ,int length)
	{
		this.width = width ;
		this.length = length ;
	}
	public double getPerimeter()
	{
		return 2*(this.width + this.length) ;
	}
	public double getArea()
	{
		return this.length * this.width ;
	}
	public String toString() {
		return "Rectangle [width=" + width + ", length=" + length + "]";
	}
}
class Circle extends Shape{
	private int radius ;
	public Circle(int radius)
	{
		this.radius = radius ;
	}
	public double getPerimeter()
	{
		return 2 * PI * this.radius ;
		
	}
	public double getArea()
	{
		return PI * this.radius * this.radius ;
	}
	public String toString() {
		return "Circle [radius=" + radius + "]";
	}
}
public class Main {
	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in) ;
		while(sc.hasNext())
		{
			int n = sc.nextInt() ;
			Shape shape [] = new Shape [n] ;
			for (int i = 0; i < shape.length; i++)
			{
				String str = sc.next();
				if("rect".equals(str))
				{
					shape[i] = new Rectangle(sc.nextInt(),sc.nextInt()) ;
				}
				if("cir".equals(str)){
					shape[i] = new Circle(sc.nextInt()) ;
				}
			}
			System.out.println(new Shape().sunAllPerimeter(shape));
			System.out.println(new Shape().sumAllArea(shape));
			System.out.println(Arrays.toString(shape));
			for (int i = 0; i < shape.length; i++) {
				System.out.println(shape[i].getClass()+","+shape[i].getClass().getSuperclass());
			}
		}
	}
}